<?php echo $javascript->cacheEvents(false, true); ?>
<?php echo $javascript->codeBlock(); ?>
		$(document).ready(function()
		{
			$("#selectall").click(function()				
			{
				var checked_status = this.checked;
				$(".select-chekbox").each(function()
				{
					this.checked = checked_status; 
				});
			});					
		});
<?php echo $javascript->blockEnd(); ?>


<div id="mws-container" class="clearfix">
  <div class="container">
    <div class="mws-panel grid_8">
      <div class="mws-panel-header"> <span class="mws-i-24 i-table-1">Pages - Management</span> 
          <span class="linktop">
              <?php echo $this->Html->link('Add New Page', array('controller'=>'setups', 'action' => 'admin_page_create')); ?>
          </span>
      </div>
      <div class="mws-panel-body">
        <div class="dataTables_wrapper">
          <table class="mws-datatable-fn mws-table">
            <thead>
              <tr>
                <th> 
				<?php echo $form->input('',array('type' => 'checkbox' ,'id' =>'selectall', 
				'hiddenField' => false, 'class'=>'select-chekbox', 'label' => false)); ?>
                </th>
                <th class="sorting" rowspan="1" colspan="1" style="width: 141px;"> <div class="colm-end">Sr No.</div></th>
                <th class="sorting" rowspan="1" colspan="1" style="width: 239px;">  <div class="colm-end">Page Title</div></th>
                <th class="sorting" rowspan="1" colspan="1" style="width: 150px;"> <div class="colm-end">Meta Description</div></th>
                <th class="sorting" rowspan="1" colspan="1" style="width: 91px;"> <div class="colm-end">Page Keywords</div></th>
                <th class="sorting" rowspan="1" colspan="1" style="width: 91px;"> <div class="colm-end">Actions</div></th>
              </tr>
            </thead>
            <?php if(isset($page_list) and ($page_list)): ?>
            <tbody>
            <?php  $x =0;
			
			foreach($page_list as $page){
				
				//pr($Page);
				//exit;
				if($x%2==0)
				{
					$class ="odd";
				}
				else
				{
					$class ="even"; 
				}
				?>
              <tr class="gradeA <?php echo $class ; ?>">
               <td class=" sorting_1">		<?php echo $form->input('Page.id'.'',array('type' => 'checkbox' ,'name' =>'data[checksel][]', 'hiddenField' => false,  'id' => 'checkselinput-'.$x, 'value'=>''.$page['Page']['id'].'', 'class'=>'select-chekbox', 'label' => false)); ?>
</td>
                <td class=" sorting_1"><?php echo $x; ?></td>
                <td class=" sorting_1"><?php echo $html->link(''.substr($page['Page']['page_title'],0,13).'..', array('controller'=>'setups', 'action' => 'admin_page_edit',$page['Page']['slug']), array('escape' => false, 'title' => 'Edit Page '.$page['Page']['page_title'].''));?></td>
                <td><?php echo substr($page['Page']['meta_description'],0,13);?>..</td>
                <td class="center">
					<?php echo substr($page['Page']['page_keywords'],0,13); ?>..
                 </td>
                <td class="center">
				<?php echo $html->link('Edit', array('controller'=>'setups',
                'action' => 'admin_page_edit',$page['Page']['slug']), array('escape' => false));?>
                &nbsp;|&nbsp;
				<?php
				 echo $html->link('Delete',
				 array('controller'=>'Setups', 'action' => 'admin_delete_by_id',
				'Page',$page['Page']['id'],'admin_pages_list'), array('escape' => false,'id'=>'alink'), 'Are you sure?');
                  ?>
               |&nbsp;
                <a href="<?php echo $website_url; ?><?php echo $page['Page']['slug'] ?>" >View</a>
                </td>
              </tr>
              <?php $x++;} ?>
            </tbody>
            <?php endif; ?>
          </table>
          <div class="dataTables_info">   
              <input type="submit" onclick="return confirm('Are you sure to delete Selected Users?');" value="Delete Selected" class="delete_button_">
        </div>
          <div class="dataTables_paginate paging_full_numbers">
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
